package com.heima.wemedia.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.heima.wemedia.entity.WmMaterial;
import com.heima.wemedia.entity.WmNewsMaterial;
import com.heima.wemedia.mapper.WmNewsMaterialMapper;
import com.heima.wemedia.service.WmNewsMaterialService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 自媒体图文引用素材信息表 服务实现类
 * </p>
 *
 * @author HM
 * @since 2022-10-19
 */
@Service
public class WmNewsMaterialServiceImpl extends ServiceImpl<WmNewsMaterialMapper, WmNewsMaterial> implements WmNewsMaterialService {

    @Override
    public void saveaa(List<Integer> getcontentids, Integer id1, int i) {
        ArrayList<WmNewsMaterial > list = new ArrayList<>();
        for (Integer getcontentid : getcontentids) {
            WmNewsMaterial wmNewsMaterial = new WmNewsMaterial();
            wmNewsMaterial.setMaterialId(getcontentid);
            wmNewsMaterial.setNewsId(id1);
            wmNewsMaterial.setType(i);
            list.add(wmNewsMaterial);
        }


    }

    @Override
    public List<WmMaterial> list(LambdaQueryWrapper<WmMaterial> queryWrapper) {
        return null;
    }

    @Override
    public void DeleteById(Integer id1) {
        LambdaQueryWrapper<WmNewsMaterial> lqw=new LambdaQueryWrapper<>();
        lqw.eq(WmNewsMaterial::getId,id1 );
        remove(lqw);
    }
}
